index.html.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <HomePageNavigation></HomePageNavigation>
  5. <!-- 广告位 1 -->
  6. <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
  7. <!-- 面包屑导航 -->
  8. <div class="breadcrumb">
  9. <div class="inner">
  10. <span class="location">当前位置:</span>
  11. <el-breadcrumb :separator-icon="ArrowRight">
  12. <el-breadcrumb-item>
  13. <NuxtLink to="/">首页</NuxtLink>
  14. </el-breadcrumb-item>
  15. <el-breadcrumb-item>
  16. {{ newsDetail.con_title }}
  17. </el-breadcrumb-item>
  18. </el-breadcrumb>
  19. </div>
  20. </div>
  21. <!-- 资讯列表 -->
  22. <div class="newsDetail">
  23. <div class="inner">
  24. <div class="innerDetail">
  25. <div class="headImg"></div>
  26. <div class="innerDetail1">
  27. <div class="leftBottom" v-html="newsDetail.content"></div>
  28. </div>
  29. <div class="footImg"></div>
  30. </div>
  31. <div class="innerLeft">
  32. <ul>
  33. <li>
  34. 导航列表
  35. </li>
  36. <li v-for="(item, index) in bottomMenu" :key="index">
  37. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  38. v-if="item.id == pageId && item.id != 7" class="active">
  39. {{ item.name }}
  40. </NuxtLink>
  41. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  42. v-else-if="item.id != pageId && item.id != 7">
  43. {{ item.name }}
  44. </NuxtLink>
  45. </li>
  46. </ul>
  47. </div>
  48. <div style="clear: both;"></div>
  49. </div>
  50. </div>
  51. <!-- 广告位 2 -->
  52. <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
  53. <!-- 页面底部 -->
  54. <HomeFoot1></HomeFoot1>
  55. </template>
  56. <script setup>
  57. //1.页面依赖 start ---------------------------------------->
  58. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  59. import { ArrowRight } from '@element-plus/icons-vue'
  60. import { ref, onMounted } from 'vue';
  61. //获得跳转过来的id
  62. const route = useRoute();
  63. //获得当前的完整路径
  64. const fullPath = route.path;
  65. //拆分,取出来中间这一段,然后提取数字部分
  66. const segments = fullPath.split('/');
  67. const targetSegment = segments[2];
  68. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  69. let articleId;
  70. let pageId;
  71. //通过导航路径反向查询导航id
  72. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  73. method: 'GET',
  74. query: {
  75. 'foot_pinyin': targetSegment,
  76. },
  77. });
  78. if(getRouteId.code == 200){
  79. articleId = getRouteId.data.id;
  80. pageId = getRouteId.data.id;
  81. }else{
  82. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  83. console.log("错误位置:通过url路径查询导航池id")
  84. console.log("后端错误反馈:",getRouteId.message)
  85. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  86. }
  87. //1.页面依赖 end ---------------------------------------->
  88. //2.页面数据 start ---------------------------------------->
  89. //广告列表
  90. let adImg1 = ref([]);
  91. let adImg2 = ref([]);
  92. //获取详情
  93. const newsDetail = ref({})
  94. async function getPageData() {
  95. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  96. method: 'GET',
  97. query: {
  98. 'fcat_id': articleId,
  99. 'type': '0'
  100. },
  101. });
  102. console.log('newsDetail.value', mkdata.data);
  103. newsDetail.value = mkdata.data;
  104. console.log('newsDetail.value', newsDetail.value);
  105. }
  106. getPageData();
  107. //获得底部导航
  108. const bottomMenu = ref([]);
  109. async function getPageMenu() {
  110. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  111. method: 'GET',
  112. query: {},
  113. });
  114. bottomMenu.value = mkdata.data;
  115. }
  116. getPageMenu();
  117. //2.页面数据 end ---------------------------------------->
  118. //4.设置seo信息 start---------------------------------------->
  119. //4.1 设置seo信息
  120. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  121. method: 'GET',
  122. query: {},
  123. });
  124. let seoTitle = setData.data.website_head.title;
  125. let seoDescription = setData.data.website_head.description;
  126. let seoKeywords = setData.data.website_head.keywords;
  127. let seoSuffix = setData.data.website_head.suffix;
  128. let seoName = setData.data.website_head.website_name;
  129. useSeoMeta({
  130. title: seoTitle + "_" + seoSuffix,
  131. meta: [
  132. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  133. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
  134. ]
  135. });
  136. //4.设置seo信息 end---------------------------------------->
  137. onMounted(async () => {
  138. //从客户端获取行政职能部门 加快打开速度
  139. const { $webUrl, $CwebUrl } = useNuxtApp();
  140. //广告1
  141. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0001`
  142. const responseAd1 = await fetch(url, {
  143. headers: {
  144. 'Content-Type': 'application/json',
  145. 'Userurl': $CwebUrl,
  146. 'Origin': $CwebUrl
  147. }
  148. });
  149. const resultAd1 = await responseAd1.json();
  150. adImg1.value = resultAd1.data[0];
  151. //广告2
  152. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0002`
  153. const responseAd2 = await fetch(url2, {
  154. headers: {
  155. 'Content-Type': 'application/json',
  156. 'Userurl': $CwebUrl,
  157. 'Origin': $CwebUrl
  158. }
  159. });
  160. const resultAd2 = await responseAd2.json();
  161. adImg2.value = resultAd2.data[0];
  162. })
  163. </script>
  164. <style lang="less" scoped>
  165. //导航条
  166. .breadcrumb {
  167. width: 1200px;
  168. margin: 0 auto;
  169. height: 22px;
  170. padding-bottom: 40px;
  171. margin-top: 40px;
  172. margin-bottom: 60px;
  173. border-bottom: 1px solid #d9d9d9;
  174. font-family: Microsoft YaHei, Microsoft YaHei;
  175. font-weight: 400;
  176. font-size: 20px;
  177. color: #666666;
  178. line-height: 23px;
  179. text-align: left;
  180. font-style: normal;
  181. text-transform: none;
  182. .el-breadcrumb::v-deep {
  183. display: inline-block;
  184. vertical-align: -4px;
  185. }
  186. /deep/.el-breadcrumb__inner a,
  187. /deep/.el-breadcrumb__inner.is-link {
  188. color: #666666;
  189. font-weight: 400;
  190. text-decoration: none;
  191. transition: var(--el-transition-color);
  192. }
  193. span {
  194. font-family: Microsoft YaHei, Microsoft YaHei;
  195. font-weight: 400;
  196. font-size: 20px;
  197. color: #666666;
  198. line-height: 23px;
  199. text-align: left;
  200. font-style: normal;
  201. text-transform: none;
  202. }
  203. span:hover {
  204. color: #666666;
  205. }
  206. .location {
  207. margin-right: 20px;
  208. width: 100px;
  209. height: 22px;
  210. font-family: Microsoft YaHei, Microsoft YaHei;
  211. font-weight: 400;
  212. font-size: 20px;
  213. color: #666666;
  214. line-height: 23px;
  215. text-align: left;
  216. font-style: normal;
  217. text-transform: none;
  218. }
  219. }
  220. // 资讯列表
  221. .newsDetail {
  222. width: 100%;
  223. // height: 1400px;
  224. // margin-bottom: 70px;
  225. .inner {
  226. width: 1200px;
  227. font-size: 16px;
  228. position: relative;
  229. .innerDetail {
  230. width: 1080px;
  231. margin: 0 auto;
  232. margin-bottom: 60px;
  233. .headImg {
  234. width: 1086px;
  235. height: 10px;
  236. background: url("../../../public/special/head11.png") no-repeat 100% 100%;
  237. }
  238. .footImg {
  239. width: 1086px;
  240. height: 7px;
  241. background: url("../../../public/special/foot01.png") no-repeat 100% 100%;
  242. }
  243. .innerDetail1 {
  244. width: 1086px;
  245. margin: 0 auto;
  246. padding: 30px 50px 40px;
  247. box-sizing: border-box;
  248. border-left: 1px solid #DBBE9E;
  249. background: url("../../../public/special/mid01.png") repeat-y 100% 100%;
  250. }
  251. .leftBottom::v-deep {
  252. font-size: 16px;
  253. line-height: 40px;
  254. }
  255. }
  256. .innerLeft {
  257. width: 279px;
  258. position: absolute;
  259. top: 3px;
  260. left: -155px;
  261. // .rightMenuTitle {
  262. // width: 279px;
  263. // height: 69px;
  264. // font-size: 22px;
  265. // font-weight: bold;
  266. // line-height: 58px;
  267. // text-align: center;
  268. // color: #fff;
  269. // background: url("../../../../public/special/projectMoreTitle.png") no-repeat;
  270. // margin-bottom: 30px;
  271. // }
  272. ul {
  273. li {
  274. a {
  275. display: inline-block;
  276. width: 144px;
  277. height: 60px;
  278. line-height: 60px;
  279. text-align: center;
  280. background-color: #F4F4F4;
  281. border-top: 1px #fff solid;
  282. font-family: Microsoft YaHei, Microsoft YaHei;
  283. font-weight: 400;
  284. font-size: 16px;
  285. color: #000000;
  286. }
  287. }
  288. li:nth-child(1) {
  289. width: 144px;
  290. height: 60px;
  291. line-height: 60px;
  292. text-align: center;
  293. background-color: #F4F4F4;
  294. border-top: 1px #fff solid;
  295. font-family: Microsoft YaHei, Microsoft YaHei;
  296. font-weight: 400;
  297. font-size: 16px;
  298. color: #a01c0e;
  299. }
  300. }
  301. .active {
  302. // border-left: 0;
  303. // border: 1px solid #028E21;
  304. background: #a01c0e;
  305. color: #fff;
  306. }
  307. }
  308. }
  309. }
  310. </style>